package com.score.pojo;

import lombok.Data;

import java.text.SimpleDateFormat;
import java.util.Date;

@Data
public class ResponseEntry {
    private int code;
    private String date;
    private Object data;
    private String message;

    public ResponseEntry(int code, Object data, String message) {
        SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date d= new Date();
        this.date = sdf.format(d);
        this.code = code;
        this.data = data;
        this.message = message;
    }

    public ResponseEntry() {
    }

    public ResponseEntry ok(String message,Object data){
        return new ResponseEntry(200,data,message);
    }
    public ResponseEntry fail(String message,Object data){
        return new ResponseEntry(404,data,message);
    }

}
